﻿using UnityEngine;
using System.Collections;
using ProtoBuf.Message;

namespace UI
{
    public class UIUnionFightTaskItem : MonoBehaviour
    {
        public UILabel score;
        public UILabel progress;
        public UILabel info;
        public GameObject achieved;
        public GameObject unAchieved;
        public UISprite icon;
        public UILabel taskNum;
        
        //个人任务
        public void SetItem(InstUFPlayerMission item)
        {
            info.text = "[CC660C]" + item.missionDesc + "[-]";
            taskNum.gameObject.SetActive(false);
            achieved.SetActive(item.isComplete == 1);
            unAchieved.SetActive(item.isComplete == 0);
            progress.text = item.progress;
            score.text = "*" + item.rewardNum;
            icon.spriteName = item.missionIcon;
        }

        //公会任务
        public void SetItem(InstUFUnionMission item)
        {
            progress.text = item.progress;
            icon.spriteName = item.missionIcon;
            if (item.missionBalanceType == 0)
            {
                info.text = "[CC660C]" + item.missionDesc + "[-]";
                score.text = "*" + item.rewardNum;
                taskNum.gameObject.SetActive(false);
                achieved.SetActive(item.isComplete == 1);
                unAchieved.SetActive(item.isComplete == 0);
            }
            else
            {
                achieved.SetActive(false);
                unAchieved.SetActive(false);
                progress.transform.parent.gameObject.SetActive(false);
                info.text = "[cc0c0c]" + item.missionDesc + "[-]";
                score.transform.parent.GetComponent<UILabel>().text += TableTextBlo.GetText("every_times");
                taskNum.text = string.Format(TableTextBlo.GetText("union_fight_task_Num"), item.progress);
            }
        }
    }
}

